#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <iterator>
using namespace std;
class date {
    friend istream& operator>>(istream& in, date& d);
public:
    date(int year=2021,int month=1,int day=1)
    {
        _year = year;
        _month = month;
        _day = day;
    }
    int getmonth(int year, int month) {
        static int arr[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))) {
            return 29;
        }
        return arr[month];
    }
    int operator-(const date& d)const;
    bool operator < (const date& d)const;
    bool operator != (const date& d)const;
    date& operator+=(int day);
    date& operator++();
private:
    int _year;
    int _month;
    int _day;
};
bool date::operator != (const date& d)const
{
    return _month != d._month || _year != d._year || _day != d._day;
}
bool date::operator < (const date& d)const {
    if (_year < d._year) {
        return true;
    }
    else if (_year == d._year) {
        if (_month < d._month) {
            return true;
        }
        else if (_month == d._month) {
            return _day < d._day;
        }
    }
    return false;
}
date& date::operator+=(int day) {
    _day += day;
    while (_day > date::getmonth(_year, _month)) {
        _day -= date::getmonth(_year, _month);
        _month++;
        if (_month == 13) {
            _year++;
            _month = 1;
        }
    }
    return *this;
}
date& date::operator++() {
    *this += 1;
    return *this;
}

int date::operator-(const date& d) const{
    date max = *this;
    date min = d;
    int flag = 1;
    if (*this < d) {
        max = d;
        min = *this;
        flag = -1;
    }
    int n = 0;
    while (min != max) {
        ++min;
        n++;
    }
    return n * flag;
}
istream& operator>>(istream& in, date& d) {
    cin >> d._year>>d._month>>d._day;
    return in;
}
int main() {
    date d1;
    date d2;
    cin >> d1>>d2;

    cout << (d1 - d2) << endl;
    return 0;
}